package com.pigcloud.sop.gatewaycommon.gateway.loadbalancer;

import com.pigcloud.sop.gatewaycommon.loadbalancer.ServerChooserContext;
import org.springframework.cloud.client.ServiceInstance;
import org.springframework.web.server.ServerWebExchange;

/**
 * 自定义路由
 *
 */
public interface SopLoadBalancer<T> extends ServerChooserContext<T> {

    /**
     * 根据serviceId 筛选可用服务
     *
     * @param serviceId 服务ID
     * @param request   请求
     * @return
     */
    ServiceInstance choose(String serviceId, ServerWebExchange request);
}
